#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDate>
#include <QLabel>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:

    void on_set_header_btn_clicked();

    void on_set_row_btn_clicked();

    void on_set_row_base_color_btn_clicked(bool checked);

    void on_init_data_btn_clicked();

    void on_insert_row_btn_clicked();

    void on_add_row_btn_clicked();

    void on_delete_row_btn_clicked();

    void on_auto_set_height_btn_clicked();

    void on_auto_set_width_btn_clicked();

    void on_copy_table_cotent_btn_clicked();

    void on_enable_edit_table_btn_clicked(bool checked);

    void on_show_row_header_btn_clicked(bool checked);

    void on_show_col_header_btn_clicked(bool checked);

    void on_select_row_radio_btn_clicked(bool checked);

    void on_select_cell_radio_btn_clicked(bool checked);

    void on_table_widget_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);

private:
    enum class CellType : int {
        kName = 100,
        kSex,
        kBirthday,
        kNation,
        kScore,
        kPM
    };

    enum class FieldColumnNumber : int {
        kName = 0,
        kSex,
        kBirthday,
        kNation,
        kScore,
        kPM
    };

    void CreateOneItemRow(int row_number, const QString &name, const QString &Sex,
                           const QDate &brithday, const QString &nation, int score, bool isPM);
    void SetItem2TableWidget(int row_number, const QString &text, const CellType &cell_type,
                             const FieldColumnNumber &field_column_number);
    void SetItem2TableWidget(int row_number, const QString &text, const CellType &cell_type,
                             const FieldColumnNumber &field_column_number, Qt::Alignment alignment);

    Ui::MainWindow *ui;

    QLabel *cell_index_label_;
    QLabel *cell_type_label_;
    QLabel *student_id_label_;


};
#endif // MAINWINDOW_H
